package com.guli.product.app;

import com.guli.common.utils.PageUtils;
import com.guli.common.utils.R;
import com.guli.product.entity.CommentReplayEntity;
import com.guli.product.entity.SkuCanal;
import com.guli.product.service.SkuCanalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

/**
 * @Author zzb
 * @Date 2024/8/16 23:11
 * @Version 1.0
 * @description
 */
@RestController
@RequestMapping("product/skucanal")
public class SkuCanalController {
    @Autowired
    private SkuCanalService skuCanalService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = skuCanalService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Long id) {
         skuCanalService.getById(id);
        return R.ok();
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody SkuCanal skuCanal) {
        skuCanalService.save(skuCanal);
        return R.ok();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    public R update(@RequestBody SkuCanal skuCanal) {
        skuCanalService.updateById(skuCanal);
        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        skuCanalService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }
}

